#!/bin/env python
#coding=utf-8
'''
author: monkey
mode_code:
1 : in
9 ： out
'''
import __future__
import re,os,sys

net_dev_path = '/proc/net/dev'
mode_code = int(sys.argv[1])
def main():
    with open(net_dev_path,'r') as file:
        data = file.readlines()
    all_net = 0
    for x in data:
        x = x.strip()
        if x.startswith('e'):
            nums = x.split(':')[-1]
            num_wish = nums.split()
            all_net += int(num_wish[mode_code-1])

    return all_net

if __name__ == '__main__':
    code = main()
    print(code)
